package com.sinodata.bsm.common.vo;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * ResType entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "RES_TYPE")
public class ResType implements java.io.Serializable, Comparable {

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = -3775432097965315478L;

    // Fields
    private Long id;
    private String code;
    private String name;
    private String desc;
    private Integer foundFlag;
    private Long parentId;
    private String icon;
    private Integer addFlag = 1;

    // Constructors

    /** default constructor */
    public ResType() {
    }

    /** minimal constructor */
    public ResType(Long id) {
        this.id = id;
    }

    /** full constructor */
    public ResType(Long id, String code, String name, String desc, Integer foundFlag, Long parentId, String icon) {
        this.id = id;
        this.code = code;
        this.name = name;
        this.desc = desc;
        this.foundFlag = foundFlag;
        this.parentId = parentId;
        this.icon = icon;
    }

    // Property accessors
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequence")
    @SequenceGenerator(name = "sequence", sequenceName = "RES_TYPE_SEQ")
    @Column(name = "ID", unique = true, nullable = false, precision = 18, scale = 0)
    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "CODE", length = 256)
    public String getCode() {
        return this.code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Column(name = "NAME", length = 256)
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "DESC_", length = 512)
    public String getDesc() {
        return this.desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    @Column(name = "FOUND_FLAG", precision = 1, scale = 0)
    public Integer getFoundFlag() {
        return this.foundFlag;
    }

    public void setFoundFlag(Integer foundFlag) {
        this.foundFlag = foundFlag;
    }

    @Column(name = "PARENT_ID", precision = 18, scale = 0)
    public Long getParentId() {
        return this.parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    @Column(name = "ICON", length = 50)
    public String getIcon() {
        return this.icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    @Column(name = "ADD_FLAG", precision = 1, scale = 0)
    public Integer getAddFlag() {
        return addFlag;
    }

    public void setAddFlag(Integer addFlag) {
        this.addFlag = addFlag;
    }

    @Override
    public String toString() {
        return "ResType [id=" + id + ", code=" + code + ", name=" + name + ", desc=" + desc + ", foundFlag=" + foundFlag + ", parentId=" + parentId + ", icon=" + icon + ",addFlag=" + addFlag + "]";
    }

    @Override
    public int compareTo(Object o) {
        ResType another = (ResType) o;
        long l = this.id.longValue() - another.id.longValue();
        return l > 0 ? 1 : (l == 0 ? 0 : -1);
    }

}